//
//  JCHDBinDingViewController.m
//  JiFengDaRen
//
//  Created by shouhan on 2018/3/28.
//  Copyright © 2018年 陈永发. All rights reserved.
//

#import "JCHDBinDingViewController.h"
#import "YLProgressBar.h"
//#import "VHLNavigation.h"
#import <JavaScriptCore/JavaScriptCore.h>

@interface JCHDBinDingViewController ()<UIWebViewDelegate>

@property (nonatomic, strong) UIWebView * webView;

@end

@implementation JCHDBinDingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    self.title = @"绑定信用卡";
    
    self.webView = [UIWebView new];

    self.webView.frame = CGRectMake(0, 0, KScreenWidth, KScreenHeight - KTABBARHEIGHT);
    
    [self.webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:self.url]]];
    
    [self.view addSubview:self.webView];

    self.webView.scalesPageToFit = YES;
    self.webView.delegate = self;

    
}
- (void)webViewDidFinishLoad:(UIWebView *)webView
{
    JSContext *content = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];
    
    content[@"closeActivity"] = ^(void) {
        [self.navigationController popViewControllerAnimated:YES];
    };
    NSLog(@"成功");
    
}

- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error
{
    NSLog(@"%@",error.localizedDescription);
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



@end
